package org.robot.scm.platform;

import java.util.Comparator;
import java.util.List;
import lombok.Getter;

/**
 * @Author : Awn create on 2024/6/6 15:12
 */
public abstract class AbstractRegistry {

    @Getter
    private static final List<? extends AbstractRegistry> registries = ReflectionLoader.load(AbstractRegistry.class);

    public static void start() {
        // 部分应用要求顺序启动
        registries.sort(Comparator.comparingInt((AbstractRegistry o) -> o.getOrder()));
        registries.forEach(AbstractRegistry::registry);
    }

    public abstract void registry();

    public int getOrder() {
        return 0;
    }

}
